package com.njupt.mapper;

import java.util.List;

import com.njupt.po.Student;
import org.apache.ibatis.annotations.*;

public interface StudentMapper 
{
	@Select("select * from student where stuID=#{stuID} and pwd=#{pwd2}")
	public abstract Student login(@Param("stuID")String stuID,
								  @Param("pwd2")String pwd);

	@Select("select * from student")
	public List<Student>  getAllStudent();

	@Select("Select * from student where name like #{name} and majorID = #{majorID}")
	public List<Student> getStudent(Student student);

	@Select("Select * from student where name like #{name}")
	public List<Student> getStudentByName(Student student);

	@Insert("Insert into student (stuID,name,majorID,enrollTime,sex,sfzh) values " +
			"(#{student.stuID},#{student.name},#{student.majorID},#{student.enrollTime},#{student.sex},#{student.sfzh})")
	public Integer newStudent(@Param("student")Student student);

	@Select("Select max(stuID) from student")
	public String maxStuID();

	@Delete("Delete from student where stuID=#{stuID}")
	public int deleteStudent(@Param("stuID") String stuID);

	@Update("Update student set majorID=#{majorID} where stuID=#{stuID}")
	public int modifyStudent(@Param("stuID") String stuID,@Param("majorID") Integer majorID);
}
